<?php

/**
 * Communication form base class.
 *
 * @method Communication getObject() Returns the current form's model object
 *
 * @package    tfe
 * @subpackage form
 * @author     3emeIG
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseCommunicationForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'id_contact'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Contact'), 'add_empty' => true)),
      'id_groupe'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Groupe'), 'add_empty' => true)),
      'type'        => new sfWidgetFormChoice(array('choices' => array('Téléphone' => 'Téléphone', 'E-mail' => 'E-mail', 'Fax' => 'Fax', 'Courrier' => 'Courrier', 'SMS' => 'SMS', 'Oral' => 'Oral', 'Braille' => 'Braille', 'Signaux de fumée' => 'Signaux de fumée', 'Morse' => 'Morse', 'Uppercut' => 'Uppercut', 'Autre' => 'Autre'))),
      'date'        => new sfWidgetFormDate(),
      'objet'       => new sfWidgetFormInputText(),
      'commentaire' => new sfWidgetFormTextarea(),
      'deleted_at'  => new sfWidgetFormDateTime(),
      'created_at'  => new sfWidgetFormDateTime(),
      'updated_at'  => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'id_contact'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Contact'), 'required' => false)),
      'id_groupe'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Groupe'), 'required' => false)),
      'type'        => new sfValidatorChoice(array('choices' => array(0 => 'Téléphone', 1 => 'E-mail', 2 => 'Fax', 3 => 'Courrier', 4 => 'SMS', 5 => 'Oral', 6 => 'Braille', 7 => 'Signaux de fumée', 8 => 'Morse', 9 => 'Uppercut', 10 => 'Autre'), 'required' => false)),
      'date'        => new sfValidatorDate(array('required' => false)),
      'objet'       => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'commentaire' => new sfValidatorString(array('required' => false)),
      'deleted_at'  => new sfValidatorDateTime(array('required' => false)),
      'created_at'  => new sfValidatorDateTime(),
      'updated_at'  => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('communication[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Communication';
  }

}
